/***************************************************************************
 创建者: 华磊
 开始时间: 2020.8.14
 copyright: (C) 华友高科
 修改说明: (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 example (1) hualei 2020.5.8 类的具体实现代码编写

 ***************************************************************************
 *  @file x.h
 *  功能:
 *
 *                                                                         *
 ***************************************************************************/
#ifndef LASERCALCULATE_H
#define LASERCALCULATE_H

#include "globalDefine.h"
#include "gSoapFoundation/soapStub.h"


/**
 * @brief The LaserCalculate class 激光数据滤波
 */
class LaserCalculate
{
public:
    LaserCalculate();

public:
    int laserFilterBySkip(int skipNum,LaserDataInfo &laserDataOut);
    int laserFilterByAngle(double minAngleIn,double maxAngleIn,LaserDataInfo &laserDataOut);
    int tranlatePointCloutToVehicleOrigin(LaserScanDeviceInfo deviceInfo,const PointCloudData_3D &pointCloudIn,
                                          PointCloudData_3D &pointCloudOut);
    int setLaserIntensityFilter(double minumIntensityIn, double maxLaserRangeIn,double minAngleIn,double maxAngleIn);
    int laserFilterByIntensity(const LaserDataInfo &frontLaserDataIn,
                           LaserDataInfo &frontLaserDataOut);
    int laserFilterByIntensity(double minumIntensityIn, double maxLaserRangeIn,double minAngleIn, double maxAngleIn, const LaserDataInfo &frontLaserDataIn,
                           LaserDataInfo &frontLaserDataOut);

    /**
     * @brief transformToCartesianPosition
     * @param laserData
     * @param posX , unit is cm
     * @param posY, unit is cm
     * @return
     */
    int transformToCartesianPosition(int skipInterval, const LaserDataInfo &laserData, std::vector<double> &posX,
                                    std::vector<double> &posY);
    /**
     * @brief deleteFlyPoint
     * @param allowMiniumAngle 点跳的越远，该角度越小。　allowMiniumAngle设置的越大，过滤掉的点越多。
     * @param laserDataIn
     * @param laserDataOut
     * @return
     */
    int deleteFlyPoint(double allowMiniumAngle, const LaserDataInfo &laserDataIn, LaserDataInfo &laserDataOut);
    /**
     * @brief findReflectiveStripe
     * @param minumIntensity
     * @param minStripeWidth
     * @param maxStripeWidth
     * @param frontLaserDataIn
     * @param posX, 相对反光条左角点，　unit is m
     * @param posY, 相对反光条左角点，　unit is m
     * @param posRotate, 相对反光条左角点，　unit is rad
     * @return
     */
    int findReflectiveStripe(double minumIntensity,double minStripeWidth,double maxStripeWidth,
                             const LaserDataInfo &frontLaserDataIn,
                             std::vector<double> &posX,std::vector<double> &posY,
                             std::vector<double> &posRotate);

private:
    double transformToPi(double angleIn);


private:
    double minumIntensity;
    double maxLaserRange;
    double minAngle;
    double maxAngle;
};

#endif // LASERCALCULATE_H
